package com.hermit.qmst.UI.activitys;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.hermit.qmst.R;
import com.hermit.qmst.UI.activity.DialSetActivity;
import com.hermit.qmst.tools.Preferences;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

/**
 * Created by Administrator on 2017/1/5 0005.
 */
@ContentView(R.layout.new_activity_set)
public class SetActivity extends Activity implements View.OnClickListener {
    @ViewInject(R.id.iv_back)
    ImageView mIvBack;
    @ViewInject(R.id.tv_title)
    TextView mTvTitle;
    @ViewInject(R.id.tv_item_1)
    TextView mTvItem1;
    @ViewInject(R.id.tv_item_2)
    TextView mTvItem2;
    @ViewInject(R.id.tv_item_3)
    TextView mTvItem3;
    @ViewInject(R.id.tv_item_4)
    TextView mTvItem4;
    @ViewInject(R.id.tv_item_5)
    TextView mTvItem5;
    @ViewInject(R.id.bt_save)
    Button mBtSave;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);
        mTvTitle.setText("设置");
        mIvBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        mBtSave.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Preferences p = new Preferences(SetActivity.this);
                p.setPreferenceStringValue(Preferences.MY_PHONE, null);
                Intent intent = new Intent(SetActivity.this, com.hermit.qmst.UI.activitys.LoginActivity.class);
                startActivity(intent);
                finish();
            }
        });
        mTvItem3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(SetActivity.this, "是最新版本，无需更新", Toast.LENGTH_SHORT).show();
            }
        });
        mTvItem1.setOnClickListener(this);
        mTvItem2.setOnClickListener(this);
        mTvItem4.setOnClickListener(this);
        mTvItem5.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.tv_item_1:
                intent.setClass(SetActivity.this, DialSetActivity.class);
                startActivity(intent);
                break;
            case R.id.tv_item_2:

                intent.setClass(SetActivity.this, SetActivity.class);
                break;
            case R.id.tv_item_4:
                intent.setClass(SetActivity.this, SetActivity.class);
                break;
            case R.id.tv_item_5:
                intent.setClass(SetActivity.this, SetActivity.class);
                break;

        }

    }

}
